package com.main.hotel.repository;

import com.main.hotel.entity.RoomType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface RoomTypeRepository extends JpaRepository<RoomType, Integer>,
        JpaSpecificationExecutor<RoomType> {
   @Modifying
    @Query(value = "delete from room_type where name= ?1", nativeQuery = true)
        public int deleteRoomTypeByName(String name);
    @Query(value = "select * from roomtype where roomtype_id= ?1", nativeQuery = true)
    RoomType findByCustomerId(int roomtype_id);

    @Query(value = "select price from room_type where name= ?1", nativeQuery = true)
  float getRoomPrice(String name);

}
